<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('LicensePlate/index')}">卖家列表</a></li>
			<li class="active"><a href="{:url('LicensePlate/add')}">添加卖家</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('LicensePlate/add')}">
			<div class="form-group">
				<label for="input-company" class="col-sm-2 control-label"><span class="form-required">*</span>公司名称</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-company" required name="company">
				</div>
			</div>


			<div class="form-group">
				<label for="input-cid" class="col-sm-2 control-label"><span class="form-required">*</span>行业类别</label>
				<select class="form-control" name="category_first" style="width: 160px;float: left;margin-left: 14px" id="first_cate">
					<volist name="industryCate" id="vo">
						<option value="{$vo.id}">{$vo.name}</option>
					</volist>
				</select> &nbsp;&nbsp;
				<select class="form-control" name="cid" style="width: 160px; float: left;margin-left: 10px" id="second_cate">
				</select>
			</div>

			<div class="form-group">
				<label for="input-corporation" class="col-sm-2 control-label"><span class="form-required">*</span>法人代表</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-corporation" required name="corporation">
				</div>
			</div>
			<div class="form-group">
				<label for="input-registered_capital" class="col-sm-2 control-label"><span class="form-required">*</span>注册资金</label>
				<div class="col-md-6 col-sm-10 input-group" style="width:200px;padding: 0 15px;">
					<input type="number" class="form-control" id="input-registered_capital" required name="registered_capital">
					<span class="input-group-addon">万元</span>
				</div>
			</div>
			<div class="form-group">
				<label for="input-currency" class="col-sm-2 control-label"><span class="form-required">*</span>货币种类</label>
				<div class="col-md-6 col-sm-10">
					<input class="form-control" type="text" style="width:400px;" required value="{$defCurrency.name}"
						   placeholder="请选择币种" onclick="doSelectLayer(this);"
						   data-url="{:url('resource/currency/select')}" data-id="input-currency" name="layer_temp[1]"
						   readonly/>
					<input class="form-control" type="hidden" value="{$defCurrency.id}" name="currency"
						   id="input-currency"/>
				</div>
			</div>
			<div class="form-group">
				<label for="input-regtime" class="col-sm-2 control-label"><span class="form-required">*</span>成立日期</label>
				<div class="col-md-6 col-sm-10">
					<input class="form-control js-bootstrap-date" required data-max-date="{:date('Y-m-d')}" type="text" name="regtime" id="input-regtime"
						   value="{:date('Y-m-d')}">
				</div>
			</div>
			<div class="form-group">
				<label for="select-area" class="col-sm-2 control-label"><span class="form-required">*</span>注册地区</label>
				<div class="col-md-6 col-sm-10">
					<select class="form-control" id="select-area" name="area" required>
						<option>请选择</option>
						<volist name="areaslist" id="vo">
							<option value="{$vo.areaid}">{$vo.name}</option>
						</volist>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="input-address" class="col-sm-2 control-label">注册地址</label>
				<div class="col-md-6 col-sm-10">
					<input type="tel" class="form-control" id="input-address" name="address">
				</div>
			</div>
			<div class="form-group">
				<label for="input-business" class="col-sm-2 control-label">主营业务</label>
				<div class="col-md-6 col-sm-10">
					<input type="tel" class="form-control" id="input-business" name="business">
				</div>
			</div>
			<div class="form-group">
				<label for="input-phone" class="col-sm-2 control-label"><span class="form-required">*</span>联系电话</label>
				<div class="col-md-6 col-sm-10">
					<input type="tel" class="form-control" id="input-phone" required name="phone">
				</div>
			</div>
			<div class="form-group">
				<label for="input-email" class="col-sm-2 control-label"><span class="form-required">*</span>邮箱</label>
				<div class="col-md-6 col-sm-10">
					<input type="tel" class="form-control" id="input-email" required name="email">
				</div>
			</div>
			<div class="form-group">
				<label for="input-situation" class="col-sm-2 control-label"><span class="form-required">*</span>公司情况</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-situation" required name="situation">
				</div>
			</div>
			<div class="form-group">
				<label for="input-manager" class="col-sm-2 control-label"><span class="form-required">*</span>负责人</label>
				<div class="col-md-6 col-sm-10">
					<input class="form-control" type="text" style="width:400px;" required value="{$default.name|default=''}"
						   placeholder="请选择负责人" onclick="doSelectLayer(this);"
						   data-url="{:url('department/user/select')}" data-id="input-manager" name="layer_temp[3]"
						   readonly/>
					<input class="form-control" type="hidden" value="" name="manager"
						   id="input-manager"/>
				</div>
			</div>
			<div class="form-group">
				<label for="input-createtime" class="col-sm-2 control-label">录入时间</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control js-bootstrap-datetime" id="input-createtime" data-max-date="{:date('Y-m-d H:i')}" value="{:date('Y-m-d H:i')}" required name="createtime">
				</div>
			</div>
			<div class="form-group">
				<label for="input-record_type" class="col-sm-2 control-label">备案类型</label>
				<div class="col-md-6 col-sm-10 ">
					<input type="radio" value="1" name="record_type"> 区域
					<input type="radio" value="2" name="record_type"> 全国
				</div>
			</div>
			<div class="form-group">
				<label for="input-record_time" class="col-sm-2 control-label">备案时间</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control js-bootstrap-date" id="input-record_time" data-max-date="{:date('Y-m-d')}" value="{:date('Y-m-d')}" required name="record_time">
				</div>
			</div>
			<div class="form-group">
				<label for="input-nature" class="col-sm-2 control-label"><span class="form-required">*</span>客户性质</label>
				<div class="col-md-6 col-sm-10">
					<input class="form-control" type="text" style="width:400px;" required value="{$default.name|default=''}"
						   placeholder="请选择客户性质" onclick="doSelectLayer(this);"
						   data-url="{:url('CustomerNature/select',['type'=>1])}" data-id="input-nature" name="layer_temp[4]"
						   readonly/>
					<input class="form-control" type="hidden" value="" name="nature"
						   id="input-nature"/>
				</div>
			</div>
			<div class="form-group">
				<label for="input-price" class="col-sm-2 control-label">价格</label>
				<div class="col-md-6 col-sm-10" style="width:400px;padding: 0 15px;">
					<div class=" input-group">
						<span class="input-group-addon">¥</span>
						<input type="number" class="form-control" id="input-price" name="price">
						<span class="input-group-addon">万元</span>
					</div>
					<p class="help-block">（两位小数）</p>
				</div>
			</div>
			<div class="form-group">
				<label for="textarea-remark" class="col-sm-2 control-label">备注</label>
				<div class="col-md-6 col-sm-10">
					<textarea name="remark" class="form-control" id="textarea-remark" rows="3"></textarea>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
					<a class="btn btn-default" href="javascript:history.back(-1);">返回</a>
				</div>
			</div>
		</form>
	</div>
<script src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
   $(document).ready(function(){
	   $("#first_cate").change(function(){
           $("input[name=cid]").val("");
           var selected_id = $("#first_cate").val();
           console.info(selected_id);
           $.ajax({
               url:"{:url('LicensePlate/getCate')}",
               data: {id : selected_id},
               async:true,
               type:'GET',
               contentType:"application/json",
               dataType:"json",
               success:function(data){
                   $('#second_cate').html("");
                   $.each(data,function (k,p){
                       $('#second_cate').append('<option value="'+p.id+'">'+p.name+'</option>');
                   });
               }
           })
	   });
       $("#first_cate").change();
	});
</script>
</body>
</html>